<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>简易websocket聊天室</title>
<% 
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	String msg = request.getParameter("msg");
	if(msg==null)
		msg = "";
%>
<script>
var login = function(){
	document.getElementById('login-form').submit();
}
var msg = '<%=msg%>';
</script>
</head>
<body>
<form id="login-form" method="post" action="<%=basePath%>loginServlet">
用户名：<input type="text" name="username"/>
密码：<input type="password" name="password"/>
<button onclick="login();">登录</button>
<p id="msg"></p>
</form>
<script>
if(msg!=''){
	document.getElementById('msg').innerHTML = msg;
}
</script>
</body>
</html>